﻿/**
 * 通过类型查询所有对应的字典数据
 * @param {} type
 * @return {}
 */
function getDictionaryByType(type){
	var dictionarys;
	var e = $.ajax({
		type:"POST",
		url:"evalDictionary/getDictionaryByType",
		data:{"type":type},
		async:false,
		dataType:'json',
		success:function(result){
			dictionarys = result;
		}
	});
	return dictionarys;
}

/**
 * 遍历字典，获取key所对应的value
 * @param {} dictionaryData 字典数据集合
 * @param {} key  对应数据字典中的codeKey
 * @return {}
 */
function getValueByKey(dictionaryData, key){
	var value = null;
	if(dictionaryData != null && dictionaryData.length>0){
		for(var i=0;i<dictionaryData.length;i++){
			if(dictionaryData[i].codeKey == key){
				value = dictionaryData[i].codeValue;
				break;
			}
		}
	}
	return value;
}